package com.wangcanxuan.www.dao.mapper;

import com.wangcanxuan.www.annotation.orm.Delete;
import com.wangcanxuan.www.annotation.orm.ReturnType;
import com.wangcanxuan.www.annotation.orm.Select;
import com.wangcanxuan.www.entity.po.Apply;
import com.wangcanxuan.www.proxy.constants.ReturnDataType;

import java.util.List;

/**
 * 审核类Mapper
 *
 * @author HHLJ
 * @date 2022/04/01
 */
public interface ApplyMapper extends BaseMapper<Apply>{
    /**
     * 选择apply通过部落id列表
     *
     * @param tribeId   部落id
     * @param pageCount 页面数
     * @return {@link List}<{@link Apply}>
     */
    @Select(sql = "SELECT * FROM `apply` WHERE applying_tribe_id = ? AND status IS NULL LIMIT ?,10")
    @ReturnType(returnType = ReturnDataType.LIST)
    List<Apply> selectApplyListByTribeId (String tribeId,int pageCount);

    /**
     * 删除其他申请人申请id
     *
     * @param deleteApply 删除应用
     */
    @Delete(sql = "DELETE FROM `apply` WHERE applicant_id = ? AND status IS NULL")
    void deleteOtherApplyByApplicantId (Apply deleteApply);
}
